/**
 * @description  : 预警提醒行数据
 * @descriptionDetail : 
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-12-05 15:31:41
 */
<template>
  <view class="page">
    <view class="cearch_title">
      查询条件
    </view>
    <u-form :model="orgForm" label-position="top" label-width="auto" style="padding: 80rpx 32rpx 160rpx 32rpx" ref="uForm">
      <u-form-item label="负责人姓名:" prop="managerName">
        <u-input placeholder="请输入负责人姓名" v-model="orgForm.managerName" />
      </u-form-item>
      <u-form-item label="预警类型:" prop="warnType">
        <dic-input
          :keyWord="$u.dic.DIC_KEYS.L_WARN_TYPE"
          :dicCode="orgForm.warnType"
          :border="ifborder"
          inputAlign="left"
          type="select"
          :select-open="dicSelectOpen('reason',$u.dic.DIC_KEYS.L_WARN_TYPE)"
          placeholder="请选择"
          v-model="orgForm.warnTypeName"
          @changeInputModelData="(name)=>{$set(orgForm, 'warnTypeName', name)}"
          @click="showDic($u.dic.DIC_KEYS.L_WARN_TYPE,orgForm.warnType,'reason')"
        />
      </u-form-item>
      <u-form-item label="许可证号:" prop="licNo">
        <u-input placeholder="请输入许可证号" v-model="orgForm.licNo" />
      </u-form-item>
      <u-form-item label="发证日期:">
        <u-input placeholder="请选择发证日期" :disabled="true" v-model="orgForm.rangeDate" @click="licnDtae=true" />
      </u-form-item>
      <u-form-item label="许可证状态:" prop="licNoStatus">
        <dic-input
          :keyWord="$u.dic.DIC_KEYS.L_LIC_STATUS"
          :dicCode="orgForm.licNoStatus"
          :border="ifborder"
          inputAlign="left"
          type="select"
          :select-open="dicSelectOpen('reason',$u.dic.DIC_KEYS.L_LIC_STATUS)"
          placeholder="请选择"
          v-model="orgForm.licNoStatusName"
          @changeInputModelData="(name)=>{$set(orgForm, 'licNoStatusName', name)}"
          @click="showDic($u.dic.DIC_KEYS.L_LIC_STATUS,orgForm.licNoStatus,'reason')"
        />
      </u-form-item>
      <u-form-item label="企业名称:" prop="companyName">
        <u-input placeholder="请输入企业名称" v-model="orgForm.companyName" />
      </u-form-item>
      <u-form-item label="经营地址:" prop="businessAddr">
        <u-input placeholder="请输入经营地址" v-model="orgForm.businessAddr" />
      </u-form-item>
      <u-form-item label="到期提醒:" prop="warnRemindName" right-icon="arrow-down-fill" :right-icon-style="iconStyle">
        <u-input placeholder="请选择" :disabled="true" v-model="orgForm.warnRemindName" @click="expirationReminder=true" />
      </u-form-item>
      <u-form-item label="处理状态:" prop="warnProcessStatusName" right-icon="arrow-down-fill" :right-icon-style="iconStyle">
        <u-input placeholder="请选择" :disabled="true" v-model="orgForm.warnProcessStatusName" @click="processStatus=true" />
      </u-form-item>
    </u-form>
    <view class="submit-btns btn-other-cls">
      <u-button plain class="del" type="primary" @click="close">
        重置
      </u-button>
      <u-button class="mit" type="primary" @click="selectBtn">
        确定
      </u-button>
    </view>
    <u-calendar mode="range" max-date="2099-12-31" v-model="licnDtae" @change="handlerLicnDtae"></u-calendar>
    <!-- 下拉选择用 -->
    <dic-choice
      :keyWord="dicKeyWords"
      :currentSelect="dicCurrentSelect"
      v-model="dicShow"
      @confirm="selectDicConfirm"
    ></dic-choice>
    <u-select mode="single-column" :list="reminderShowList" v-model="expirationReminder" @confirm="unitConfirm"></u-select>
    <u-select mode="single-column" :list="processStatusList" v-model="processStatus" @confirm="statusConfirm"></u-select>
  </view>
</template>

<script>
import DicInput from "@/components/dic_input.vue";
import DicChoice from "@/components/dic_choice.vue";
export default {
  components: {
    DicInput,
    DicChoice,
  },
  data() {
    return {
      lab_style:{
        fontWeight: 500,
        color: this.$theme.u_main_color,
        fontSize: '.75rem',
      },
      iconStyle:{
        color: '#c0c4cc',
      },
      orgForm:{
        decideStartDate:'',
        decideEndDate:'',
        rangeDate:'',
        warnType:'',
        licNoStatus:'',
        warnRemind:'',
        warnProcessStatus:'',
        companyName:'',
        businessAddr:'',
        managerName:'',
        licNo:'',
      },
      dateRange:false,
      // dic_select 是否显示
      dicShow: false,
      // dic 关键字
      dicKeyWords: "",
      // dic 当前选择项
      dicCurrentSelect: "",
      dicType: "",
      // 输入框是否有border
      ifborder: false,
      expirationReminder:false,
      processStatus:false,
      licnDtae:false,
      reminderShowList:[{value: '',label: '全部',},{value: '02',label: '提醒',},{value: '01',label: '到期',},],
      processStatusList:[{value: '0',label: '未处理',},{value: '1',label: '已处理',},],
    }
  },
  onLoad() {

  },
  created(){
    this.orgForm = this.getRouteParam();
    this.init();
    console.log(this.objInfo);
  },
  methods: {
    init(){},
    handlerLicnDtae(d) {
      this.orgForm.decideStartDate = d.startDate;
      this.orgForm.decideEndDate = d.endDate;
      this.orgForm.rangeDate = d.startDate + "至" + d.endDate;
      // this.$refs["mescrollItem0"].refresh();
    },
    dicSelectOpen(type, keyWords) {
      if (type == this.dicType) {
        if (this.dicKeyWords == keyWords && this.dicShow) {
          return true;
        }
        return false;
      }
    },
    showDic(key, cur, type) {
      if (this.dicShow) return;
      this.dicKeyWords = key;
      this.dicCurrentSelect = cur;
      this.dicShow = true;
      this.dicType = type;
    },
    selectDicConfirm(e) {
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_WARN_TYPE) { // 未办证原因
        this.orgForm.warnTypeName = e[0].label;
        this.orgForm.warnType = e[0].extra.bcbCode;
      }else if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_LIC_STATUS) { // 许可证状态
        this.orgForm.licNoStatusName = e[0].label;
        this.orgForm.licNoStatus = e[0].extra.bcbCode;
      }
    },
    unitConfirm(e){
      this.orgForm.warnRemindName = e[0].label
      this.orgForm.warnRemind = e[0].value
    },
    statusConfirm(e){
      this.orgForm.warnProcessStatusName = e[0].label
      this.orgForm.warnProcessStatus = e[0].value
    },
    selectBtn(){
      this.$emit('selectChange',this.orgForm)
    },
    close(){
      this.orgForm = {};
    },
    sendEmitAction(str){
      this.$emit(str);
    },
    setActionResult(e){
		
    },
  },
}
</script>

<style scoped lang="scss">
.page{
  padding: 0;
}
.cearch_title{
  background-color: #F3F4F5;
  width: 100%;
  height: 82rpx;
  font-size: 32rpx;
  font-weight: 600;
  padding: 22rpx 0 21rpx 32rpx;
  z-index: 999;
  position: fixed;
}
.btn{
  position: fixed;
	bottom: 50rpx;
	margin: auto;
	left: 60rpx;
	right: 60rpx;
  z-index: 100;
  background-color: #ffffff;
}
.submit-btns {
  position: fixed;
display: flex;
bottom: 40rpx;
padding-left: 40rpx;
padding-right: 40rpx;
width: 100%;
text-align: center;
.del {
flex: 1;
}
.mit {
flex: 1;
margin-left: 40rpx;
}
}
.bottom-btns {
bottom: 0rpx;
width: 100%;
background-color: #ffffff;
z-index: 100;
}
/deep/.submit-btns {
  bottom: 0;
}
</style>
